package com.lwj.test.netty;
import static org.jboss.netty.channel.Channels.pipeline;

import java.nio.charset.Charset;

import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.handler.codec.string.StringDecoder;
import org.jboss.netty.handler.codec.string.StringEncoder;

public class ServerPipelineFactory implements ChannelPipelineFactory
{
    public ChannelPipeline getPipeline() throws Exception
    {
        ChannelPipeline pipleline = pipeline();
        pipleline.addLast("encode", new StringEncoder(Charset.forName("GBK")));
        pipleline.addLast("decode", new StringDecoder(Charset.forName("GBK")));
        pipleline.addLast("handler", new ServerHandler());
        return pipleline;
    }
}
